<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>API: container  YAHOO.util.KeyListener   (YUI Library)</title>
	<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css">
	<link rel="stylesheet" type="text/css" href="assets/api.css">
</head>

<body id="yahoo-com">
<div id="doc3" class="yui-t2">

	<div id="hd">
        <h1>Yahoo! UI Library</h1>
        <h3>Container&nbsp;</h3>
        <p>
        <a href="./index.html">Yahoo! UI Library</a> 
            &gt; <a href="./module_container.html">container</a>
                 &gt; YAHOO.util.KeyListener 
                
            </p>
	</div>

	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">


                    <h2>
                        

                        
                        
                            Class <b>YAHOO.util.KeyListener</b>
                        <span class="extends">
                        </span>

                        <span class="extends">
                        </span>
                        
                        </code>
                    </h2>
                    <!-- class tree goes here -->
                    
                
  

                    <div class="summary description">
                        KeyListener is a utility that provides an easy interface for listening for keydown/keyup events fired against DOM elements.
                    </div>

                        <div class="section constructor details">
                        <h3><a name="constructor_detail">Constructor</a></h3>
                        <div class="content">
                            <div class="detail">
                                <strong>YAHOO.util.KeyListener</strong>
                                <code>
                                    (
  
                                        
                                                
                                                attachTo


                                                , 
                                                keyData

                                                , 
                                                handler


                                                , 
                                                event
                                    )
                                </code>
                                <div class="description">
                                        <dl>
                                            <dt>Parameters:</dt>
                                                <dd>
                                                    <code>attachTo
                                                    &lt;HTMLElement&gt; 
                                                    </code>
                                                    	The element or element ID to which the key event should be attached
                                                </dd>
                                                <dd>
                                                    <code>attachTo
                                                    &lt;String&gt; 
                                                    </code>
                                                    	The element or element ID to which the key event should be attached
                                                </dd>
                                                <dd>
                                                    <code>keyData
                                                    &lt;Object&gt; 
                                                    </code>
                                                    		The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).
                                                </dd>
                                                <dd>
                                                    <code>handler
                                                    &lt;Function&gt; 
                                                    </code>
                                                    		The CustomEvent handler to fire when the key event is detected
                                                </dd>
                                                <dd>
                                                    <code>handler
                                                    &lt;Object&gt; 
                                                    </code>
                                                    		An object literal representing the handler.
                                                </dd>
                                                <dd>
                                                    <code>event
                                                    &lt;String&gt; 
                                                    </code>
                                                    		Optional. The event (keydown or keyup) to listen for. Defaults automatically to keydown.
                                                </dd>
                                        </dl>
                                    
                                    
                                </div>
                            </div>
                        </div>
                    </div>

                        <div class="section field details">
                            <h3><a name="field_detail">Properties</a></h3>
                            <div class="content">
                                    <h4><a name="enabled">enabled</a>
                                        <code>- Boolean</code>
                                    </h4>
                                    <div class="detail">
                                        <div class="description">
                                            Boolean indicating the enabled/disabled state of the Tooltip
                                        </div>
                                    </div>
     
                                        


                                    <hr />
                                    <h4><a name="YAHOO.util.KeyListener.KEYDOWN">YAHOO.util.KeyListener.KEYDOWN</a>
                                        <code>- static final String</code>
                                    </h4>
                                    <div class="detail">
                                        <div class="description">
                                            Constant representing the DOM "keydown" event.
                                        </div>
                                    </div>
     
                                        


                                    <hr />
                                    <h4><a name="YAHOO.util.KeyListener.KEYUP">YAHOO.util.KeyListener.KEYUP</a>
                                        <code>- static final String</code>
                                    </h4>
                                    <div class="detail">
                                        <div class="description">
                                            Constant representing the DOM "keyup" event.
                                        </div>
                                    </div>
     
                                        


                                    <hr />


                            </div>
                        </div>


                        <div class="section method details">
                            <h3><a name="methodDetails">Methods</a></h3>
                            <div class="content">
                                    <h4>
                                        <a name="disable">disable</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                        
                                        
                                        void
                                            <strong>disable</strong>
                                           (
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Disables the KeyListener by removing the DOM event listeners from the target DOM element
                                        </div>

                                        <div class="description">


                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        void
                                                    </code></dt>
                                                    <dd></dd>
                                                </dl>
             
                                        </div>

                                    </div>
                                    <hr />
                                    <h4>
                                        <a name="enable">enable</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                        
                                        
                                        void
                                            <strong>enable</strong>
                                           (
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Enables the KeyListener by attaching the DOM event listeners to the target DOM element
                                        </div>

                                        <div class="description">


                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        void
                                                    </code></dt>
                                                    <dd></dd>
                                                </dl>
             
                                        </div>

                                    </div>
                                    <hr />
                                    <h4>
                                        <a name="handleKeyPress">handleKeyPress</a></h4>
                                    <div class="detail">
                                        <code>
                                         private 
                                        
                                        
                                        void
                                            <strong>handleKeyPress</strong>
                                           (
                                                
                                                        
                                                         e
                                                    
                                                
                                                        , 
                                                         obj
                                                    
                                                
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Handles the key event when a key is pressed.
                                        </div>

                                        <div class="description">

                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>e &lt;DOMEvent&gt;</code>
                                                            	The keypress DOM event
                                                        </dd>
                                                        <dd>
                                                            <code>obj &lt;Object&gt;</code>
                                                            	The DOM event scope object
                                                        </dd>
                                                </dl>

                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        void
                                                    </code></dt>
                                                    <dd></dd>
                                                </dl>
             
                                        </div>

                                    </div>
                                    <hr />
                                    <h4>
                                        <a name="toString">toString</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                        
                                        
                                        String
                                            <strong>toString</strong>
                                           (
                                            )
                                        </code>
                                        
                                        <div class="description">
                                            Returns a String representation of the object.
                                        </div>

                                        <div class="description">


                                                <dl>
                                                    <dt>Returns:
                                                    <code>
                                                        String
                                                    </code></dt>
                                                    <dd>The string representation of the KeyListener</dd>
                                                </dl>
             
                                        </div>

                                    </div>
                                    <hr />
                            </div>
                        </div>


                        <div class="section method details">
                            <h3><a name="methodDetails">Events</a></h3>
                            <div class="content">
                                    <h4>
                                        <a name="disabledEvent">disabledEvent</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                        
                                        
                                            <strong>disabledEvent</strong>

                                            (
                                                
                                                        
                                                         keyData
                                                    
                                                
                                            )

                                        </code>
                                        
                                        <div class="description">
                                            The CustomEvent fired when the KeyListener is disabled via the disable() function
                                        </div>

                                        <div class="description">


                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>keyData &lt;Object&gt;</code>
                                                            		The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).
                                                        </dd>
                                                </dl>


                                        </div>

                                    </div>
                                    <hr />
                                    <h4>
                                        <a name="enabledEvent">enabledEvent</a></h4>
                                    <div class="detail">
                                        <code>
                                        
                                        
                                        
                                            <strong>enabledEvent</strong>

                                            (
                                                
                                                        
                                                         keyData
                                                    
                                                
                                            )

                                        </code>
                                        
                                        <div class="description">
                                            The CustomEvent fired when the KeyListener is enabled via the enable() function
                                        </div>

                                        <div class="description">


                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>keyData &lt;Object&gt;</code>
                                                            		The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).
                                                        </dd>
                                                </dl>


                                        </div>

                                    </div>
                                    <hr />
                                    <h4>
                                        <a name="keyEvent">keyEvent</a></h4>
                                    <div class="detail">
                                        <code>
                                         private 
                                        
                                        
                                            <strong>keyEvent</strong>

                                            (
                                                
                                                        
                                                         keyData
                                                    
                                                
                                            )

                                        </code>
                                        
                                        <div class="description">
                                            The CustomEvent fired internally when a key is pressed
                                        </div>

                                        <div class="description">


                                                <dl>
                                                    <dt>Parameters:</dt>
                                                        <dd>
                                                            <code>keyData &lt;Object&gt;</code>
                                                            		The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).
                                                        </dd>
                                                </dl>


                                        </div>

                                    </div>
                                    <hr />
                            </div>
                        </div>






			</div>
		</div>
		<div class="yui-b">
            <div class="nav">

                    <div class="module">
                        <h4>Modules</h4>
                        <ul class="content">

                                <li class=""><a href="module_animation.html">animation</a></li>

                                <li class=""><a href="module_autocomplete.html">autocomplete</a></li>

                                <li class=""><a href="module_calendar.html">calendar</a></li>

                                <li class=""><a href="module_connection.html">connection</a></li>

                                <li class="selected"><a href="module_container.html">container</a></li>

                                <li class=""><a href="module_dom.html">dom</a></li>

                                <li class=""><a href="module_dragdrop.html">dragdrop</a></li>

                                <li class=""><a href="module_event.html">event</a></li>

                                <li class=""><a href="module_logger.html">logger</a></li>

                                <li class=""><a href="module_menu.html">menu</a></li>

                                <li class=""><a href="module_slider.html">slider</a></li>

                                <li class=""><a href="module_tabview.html">tabview</a></li>

                                <li class=""><a href="module_treeview.html">treeview</a></li>

                                <li class=""><a href="module_yahoo.html">yahoo</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Classes</h4>
                        <ul class="content">
                                <li class=""><a href="YAHOO.util.Config.html">YAHOO.util.Config</a></li>
                                <li class="selected"><a href="YAHOO.util.KeyListener.html">YAHOO.util.KeyListener</a></li>
                                <li class=""><a href="YAHOO.widget.ContainerEffect.html">YAHOO.widget.ContainerEffect</a></li>
                                <li class=""><a href="YAHOO.widget.Dialog.html">YAHOO.widget.Dialog</a></li>
                                <li class=""><a href="YAHOO.widget.Module.html">YAHOO.widget.Module</a></li>
                                <li class=""><a href="YAHOO.widget.Overlay.html">YAHOO.widget.Overlay</a></li>
                                <li class=""><a href="YAHOO.widget.OverlayManager.html">YAHOO.widget.OverlayManager</a></li>
                                <li class=""><a href="YAHOO.widget.Panel.html">YAHOO.widget.Panel</a></li>
                                <li class=""><a href="YAHOO.widget.SimpleDialog.html">YAHOO.widget.SimpleDialog</a></li>
                                <li class=""><a href="YAHOO.widget.Tooltip.html">YAHOO.widget.Tooltip</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Files</h4>
                        <ul class="content">        
                                <li class=""><a href="Config.js.html">Config.js</a></li>
                                <li class=""><a href="ContainerEffect.js.html">ContainerEffect.js</a></li>
                                <li class=""><a href="Dialog.js.html">Dialog.js</a></li>
                                <li class=""><a href="KeyListener.js.html">KeyListener.js</a></li>
                                <li class=""><a href="Module.js.html">Module.js</a></li>
                                <li class=""><a href="Overlay.js.html">Overlay.js</a></li>
                                <li class=""><a href="OverlayManager.js.html">OverlayManager.js</a></li>
                                <li class=""><a href="Panel.js.html">Panel.js</a></li>
                                <li class=""><a href="SimpleDialog.js.html">SimpleDialog.js</a></li>
                                <li class=""><a href="Tooltip.js.html">Tooltip.js</a></li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Properties</h4>
                        <ul class="content">        
                                <li><a href="#enabled">enabled</a>
                                        <!--<code>&lt;String&gt;</code>-->
                                </li>
                                <li><a href="#YAHOO.util.KeyListener.KEYDOWN">YAHOO.util.KeyListener.KEYDOWN</a>
                                        <!--<code>&lt;String&gt;</code>-->
                                </li>
                                <li><a href="#YAHOO.util.KeyListener.KEYUP">YAHOO.util.KeyListener.KEYUP</a>
                                        <!--<code>&lt;String&gt;</code>-->
                                </li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Methods</h4>
                        <ul class="content">        
                                <li><!--<code>void</code>-->
                                <a href="#disable">disable</a>
                                </li>
                                <li><!--<code>void</code>-->
                                <a href="#enable">enable</a>
                                </li>
                                <li><!--<code>void</code>-->
                                <a href="#handleKeyPress">handleKeyPress</a>
                                </li>
                                <li><!--<code>String</code>-->
                                <a href="#toString">toString</a>
                                </li>
                        </ul>
                    </div>

                    <div class="module">
                        <h4>Events</h4>
                        <ul class="content">        
                                <li>
                                <a href="#disabledEvent">disabledEvent</a>
                                </li>
                                <li>
                                <a href="#enabledEvent">enabledEvent</a>
                                </li>
                                <li>
                                <a href="#keyEvent">keyEvent</a>
                                </li>
                        </ul>
                    </div>


            </div>
		</div>
	</div>
	<div id="ft">
        <hr />
        Copyright &copy; 2006 Yahoo! Inc. All rights reserved.
	</div>
</div>
</body>
</html>
